<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<Body>
<h1>原生：快递费用计算，一公斤10元</h1>
<p><input type="text" name="kg">公斤</p>
<p>运费：<span></span>元</p>
</Body>

<script>

    //找到对象
    const input = document.getElementsByTagName("input")[0];
    const span = document.getElementsByTagName("span")[0];
    //绑定事件
    input.oninput = function () {
        const price = 10 *  parseInt(this.value);
        span.innerHTML = price.toString();
    }
</script>
</body>
</html>
